/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package gui.article;

import java.util.ArrayList;
import java.util.Collection;
import javax.swing.AbstractListModel;
import util.article.SizeDetails;

/**
 *
 * @author Dirk
 */
public class SizeListModel extends AbstractListModel<SizeDetails>{
    
    private ArrayList<SizeDetails> sizes;

    public SizeListModel(Collection<SizeDetails> sizes) {
        this.sizes = new ArrayList<SizeDetails>();
        this.sizes.addAll(sizes);
    }
    
    public SizeListModel() {
        this.sizes = new ArrayList<SizeDetails>();
    }
    
    @Override
    public int getSize() {
        return sizes.size();
    }

    @Override
    public SizeDetails getElementAt(int index) {
        return sizes.get(index);
    }
    
    public Collection<SizeDetails> getAllSizes(){
        return sizes;
    }
    
    public void addSizes(Collection<SizeDetails> sizes){
        this.sizes.addAll(sizes);
        this.fireContentsChanged(this, 0, this.sizes.size());
    }
    
    public void removeSizes(Collection<SizeDetails> sizes){
        this.sizes.removeAll(sizes);
        this.fireContentsChanged(this, 0, this.sizes.size());
    }
    
}
